package com.xiaoshuidi.cloud.module.rooms.api;

import com.xiaoshuidi.cloud.framework.common.pojo.CommonResult;
import com.xiaoshuidi.cloud.framework.common.util.json.JsonUtils;
import com.xiaoshuidi.cloud.module.rooms.api.roomlayout.RoomLayoutApi;
import com.xiaoshuidi.cloud.module.rooms.api.roomlayout.vo.GetRoomLayoutByApartmentRespVO;
import com.xiaoshuidi.cloud.module.rooms.api.roomlayout.vo.GetRoomLayoutByApartmentsReqVO;
import com.xiaoshuidi.cloud.module.rooms.service.RoomLayoutService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

import java.util.List;

import static com.xiaoshuidi.cloud.framework.common.pojo.CommonResult.success;
import static com.xiaoshuidi.cloud.module.system.enums.ApiConstants.VERSION;

@Slf4j
@RestController
@DubboService(version = VERSION)
public class RoomLayoutApiImpl implements RoomLayoutApi {

    @Resource
    private RoomLayoutService roomLayoutService;

    /**
     * 根据门店id列表获取房型信息
     * @return
     */
    @Override
    public CommonResult<List<GetRoomLayoutByApartmentRespVO>> getRoomLayoutByApartments(GetRoomLayoutByApartmentsReqVO reqVO) {
        log.info("[API接口] 根据门店id列表获取房型信息 RoomLayoutApi.getRoomLayoutByApartments 被调用, 请求参数:{}", JsonUtils.toJsonString(reqVO));
        return success(roomLayoutService.getRoomLayoutByApartments(reqVO.getIds(), reqVO.getCount()));
    }
}
